﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using FM.时钟.ViewModels;
using Microsoft.Practices.Prism.Mvvm;

namespace FM.时钟.Views
{
    /// <summary>
    /// 主窗口.xaml 的交互逻辑
    /// </summary>
    public partial class 主窗口 : Window,IView
    {
        public 主窗口()
        {
            InitializeComponent();
            CommandBindings.Add(
             new CommandBinding(
                 ApplicationCommands.Close,
                 (o,e)=>{this.Close();}));
        }

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton== MouseButtonState.Pressed)
            {
                  DragMove();
            }
          
        }
        #region  字体缩放
        private bool _leftCtrl = false;
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.LeftCtrl )
            {
                _leftCtrl = true;
            }
        }
        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.LeftCtrl)
            {
                _leftCtrl = false;
            }
        }
        private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (_leftCtrl)
            {
                var s = sender as TextBlock;
                if (s !=null)
                {
                    s.FontSize += e.Delta > 0 ? 1 : -1;
                }
            }
        }

        #endregion


    }
}
